package com.example.springbootsfzy.controller.liujinping.vue;

import com.example.springbootsfzy.domain.SelectedArticles;
import com.example.springbootsfzy.service.liujinping.ArticleService;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class ArticlesController {

@Autowired
ArticleService articleService  ;
    /**
     * 咨询师id分页查询文章
     * @param pageNum 当前页码
     * @param pageSize 每页显示的数量
     * @param id 文章id
     * @return PageInfo
     */
    @GetMapping("/getArticles")
    @ResponseBody
    public PageInfo<SelectedArticles> getArticles(
            @RequestParam(defaultValue = "1") int pageNum,
            @RequestParam(defaultValue = "10") int pageSize,
            int id
    ) {
        return articleService.getArticles(pageNum, pageSize,id);
    }
}
